<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box1 {
            width: 100px;
            height: 100px;
            margin: 50px auto;
            background-color: red;
        }
    </style>
</head>

<body>

    <div id="app">
        <button @click="show">{{ msg?"显示":"消失"}}</button>
        <div class="box1" v-show="msg"></div>

    </div>





    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.13/dist/vue.js"></script>
    <script>
        var vm = new Vue({
            el: '#app',
            data:{
                msg: true,
            }
           ,
            methods: {
                show() {
                    this.msg = !this.msg
                }
            }
        })
    </script>

</body>

</html>